package net.mrsigma.tetris.view;

import java.awt.Graphics;

import javax.swing.JPanel;

import net.mrsigma.tetris.entitles.Ground;
import net.mrsigma.tetris.entitles.Shape;

public class GamePanel extends JPanel {
	
	private Ground ground;
	private Shape shape;

	public void display(Ground ground, Shape shape) {
		System.out.println("GamePanel's display");
		this.ground = ground;
		this.shape = shape;
		this.repaint();
	}

	@Override
	protected void paintComponent(Graphics g) {
		// TODO Auto-generated method stub
		// 重新显示
		if(shape != null && ground != null) {
			ground.drawMe();	
			shape.drawMe();
		}
	}
	
	public GamePanel() {
		this.setSize(300, 300);
	}
}
